<template>
  <div>
    订单编号<el-input v-model="no"></el-input>
    付款金额<el-input v-model="pr"></el-input>
    订单名称<el-input v-model="name"></el-input>
    商品描述<el-input v-model="ms"></el-input>
    <el-button type="primary" @click="save">付款</el-button>
  </div>
</template>

<script>
  export default {
    name: "Buy",

    data(){
      return{
        no:'',
        pr:'',
        name:'',
        ms:''
      }
    },
    methods:{
      save(){
        /*var fd=new FormData(document.getElementById('f1'));*/
        this.$axios.get('/PayServlet/pay?no='+this.no+'&pr='+this.pr+'&name='+this.name+'&ms='+this.ms)
          .then(resp=>{
            document.querySelector('body').innerHTML = resp.data;//查找到当前页面的body，将后台返回的form替换掉他的内容
            document.forms[0].submit();  //执行submit表单提交，让页面重定向，跳转到支付宝页面
          }).catch()
      }
    }
  }
</script>

<style scoped>

</style>
